package org.spring.data.jpa.base;

import org.springframework.data.domain.Persistable;

import javax.persistence.*;

/**
 *
 * @param <ID>
 */
@MappedSuperclass
public abstract class AbstractEntity<ID>  implements Persistable<ID> {
    @Transient
    private boolean isNew=true;

    @Override
    public boolean isNew() {
        return isNew;
    }
    @PrePersist
    @PostLoad
    void markNotNew(){
        this.isNew=false;
    }
}
